<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/template/common/header.jsp"%>
<script type="text/javascript">
	var alliance = {
		uploadSuccess : function(file, data, response) {
			if (!response) {
				return;
			}
			var $this = $(this);
			data = eval("(" + data + ")");
			$this
					.each(function(i) {
						var $wrapper = $this[i].wrapper;
						$wrapper.siblings("input[name='alliance.logo']").val(
								data.url);
						var fileQue = $wrapper.siblings("div.thumbImg");
						fileQue.empty();
						var img = $("<img src='" + resourceRootUrl + data.url
						+ "' height='150px'/>");
						fileQue.append(img);
					});
		}
	}
</script>
<div class="pageContent">
	<form method="post" action="${base }/alliance!doAdd.action"
		class="pageForm required-validate"
		onsubmit="return validateCallback(this, dialogAjaxDone)">
		<div class="pageFormContent" layoutH="60">
			<dl>
				<dt>名称：</dt>
				<dd>
					<input type="text" name="alliance.title" minlength="2"
						maxlength="70"
						class="{required:true,remote:{url:'${base }/alliance!checkTitle.action'},messages:{remote:'该联盟已存在！'}}" />
				</dd>
			</dl>
			<dl>
				<dt>域名：</dt>
				<dd>
					<input type="text" name="alliance.host" class="required" />
				</dd>
			</dl>
			<dl>
				<dt>根URL：</dt>
				<dd>
					<input type="text" name="alliance.url" class="required url"
						size="40" />
				</dd>
			</dl>
			<dl>
				<dt>图标：</dt>
				<dd>
					<input id="${rel }FileAlliance" target="uploadify" type="file"
						name="filedata"
						uploadifyOpts='{"onUploadSuccess":alliance.uploadSuccess,"formData":{"resize":false},"fileTypeDesc":"png","fileTypeExts":"*.png;",}' />
					<input type="hidden" name="alliance.logo" class="required">
					<div class="thumbImg"></div>
				</dd>
			</dl>
		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive">
						<div class="buttonContent">
							<button type="submit">提交</button>
						</div>
					</div></li>
				<li><div class="button">
						<div class="buttonContent">
							<button type="button" class="close">取消</button>
						</div>
					</div></li>
			</ul>
		</div>
	</form>

</div>
